import request, {buildQueryString} from "@/utils/request";
export function getMenuList(data?: {menuName: string}) {
    return request.get(`/menu/tree${buildQueryString(data)}`)
}
export interface MenuForm {
    name:       string;
    //permission: null | string;
    path:       string;
    parentId?:   number;
    icon?:       string | null;
    component:  string|null;
    type?:       number;
    sort:       number;
    dataStatus: number;
    isShowMenu: number;
}
export interface UpdateMenuForm extends MenuForm{
    id: number;
}
export function insertMenu(data: MenuForm) {
    return request.post("/menu",data)
}
export function updateMenu(data: UpdateMenuForm) {
    return request.put("/menu",data)
}
export function getMenuById(id: number) {
    return request.get(`/menu/getMenuById/${id}`)
}
export function delMenuById(id: number) {
    return request.delete(`/menu/${id}`)
}
